<?php
class PostsController extends AppController{
    
    public $paginate = array(
        'limit' => 5,
        'order' => array('Post.created DESC'),
        'contain' => array('Category'),
        'paramType' => 'querystring'
    );
    
    public function isAuthorized($user = null) {
        parent::isAuthorized($user);
        return $user['role'] == 'admin';
    }
    
    function beforeFilter() {
        parent::beforeFilter();
    }
    
    function index(){
        $posts = $this->paginate('Post');
        $this->set(compact('posts'));
        $this->set('menu','Blog');
    }
    
    function test(){
        
    }


}
